package com.fit.networkShop.pages;

import java.util.LinkedList;

import com.fit.networkShop.beans.CustomerBean;
import com.fit.networkShop.interfaces.Customer;
import com.fit.networkShop.interfaces.Purchase;
import com.fit.networkShop.service.Customers;

import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;

public class EntryCustomer {
	@Property
	@Persist
	private Customer customer;
	
	@Inject
	private Customers customers;
	
	@SetupRender
	public void createObject() {
	    customer = new CustomerBean();
		customer.setPurchases(new LinkedList<Purchase>());
	}
	
	public void onSuccess() {
		customer.executeCustomerCreation(customers);
	}
}
